<template>
    <div class="warehouse-list">
        <div
            class="list-row"
            :class="item.acitve == 1 ? 'avitve' : ''"
            v-for="item in warehouse_data_ls"
            :key="item.id"
            @click="getInfo(item)"
        >
            <div class="info-box">
                <div class="img-box">
                    <img :src="item.imgs || goodsImg" alt="" />
                </div>
                <div class="info">
                    <div class="title">{{ item.name }}</div>
                    <div class="stock-num">库存数量：{{ item.qty }}</div>
                    <div class="stock-money">库存金额：{{ item.amount }}</div>
                </div>
            </div>
            <div class="icon-box">
                <span class="duf" v-if="item.base == 1">初始</span>
                <i class="el-icon-arrow-right"></i>
            </div>
        </div>
    </div>
</template>

<script>
import staticConst from "../../js/const/StaticConst.js";

export default {
    name: "viewWarehouse",
    props: ["warehouse_data_ls"],
    data() {
        return {
            goodsImg: staticConst.GOOD_IMG,
        };
    },
    methods: {
        getInfo(item) {
            this.$emit("viewWarehouse", item);
        },
    },
};
</script>

<style lang="scss" scoped>
.warehouse-list {
    width: 343px;
    overflow-y: auto;
    height: calc(100vh - 50px);
    margin-top: 50px;
    .list-row {
        display: flex;
        display: flex;
        justify-content: space-between;
        height: 80px;
        padding: 10px;
        border-bottom: 1px #efefef solid;
        cursor: pointer;
        &.avitve {
            background: #f8f8f8;
        }
        &:hover {
            background: #f8f8f8;
        }
        .info-box {
            display: flex;
            .img-box {
                width: 80px;
                height: 80px;
                margin-right: 10px;
                img {
                    width: 100%;
                    height: 100%;
                    border-radius: 5px;
                    object-fit: cover;
                }
            }
            .info {
                div {
                    margin-bottom: 5px;
                    &:last-child {
                        margin-bottom: 0;
                    }
                }
                .title {
                    font-size: 16px;
                }
                .stock-num {
                    font-size: 12px;
                    color: #c9c9c9;
                }
                .stock-money {
                    font-size: 12px;
                    color: #fb5959;
                }
            }
        }
        .icon-box {
            height: 100%;
            display: flex;
            align-items: center;
            .duf {
                color: #fb5959;
                margin-right: 5px;
            }
            i {
                font-size: 16px;
            }
        }
    }
}
</style>